package com.uam.core.entity.model.entity.uitls;



import com.uam.core.entity.model.entity.constant.CommonConstant;

import java.math.RoundingMode;
import java.text.DecimalFormat;

/**
 * @author heguanglong
 * @description: TODO
 * @date 2021/5/28
 */
public class DecimalFormatUtils {
  private  static   DecimalFormat DECIMAL_FORMAT=null;
    static {
        DECIMAL_FORMAT = new DecimalFormat();
        DECIMAL_FORMAT.setMaximumFractionDigits(CommonConstant.SIX);
        DECIMAL_FORMAT.setGroupingSize(CommonConstant.ZERO);
        DECIMAL_FORMAT.setRoundingMode(RoundingMode.FLOOR);
    }

    /**
     *
     * @param value
     * @return
     */
    public static Double getDecimalFormatUtils(Double value){
        if(value == null ){
            return null;
        }
       return Double.valueOf(DECIMAL_FORMAT.format(value));
    }
}
